<?php



namespace App\Http\Requests\ApiV2;

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class MediaVideoRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',

        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入视频标题'),
            'title.max' => __('视频标题的长度不能超过:size个字符', ['size' => 120]),
            'thumb.required' => __('请上传视频的封面'),
            'short_description.required' => __('请输入视频的简介'),

        ];
    }

    public function filldata()
    {
        $user = Auth::user();
        return [
            'user_id'=>(int)$user['app_id'],
            'short_description' =>(string) $this->input('short_description'),
            'thumb' => (string)$this->input('thumb'),
            'size' => (int)$this->input('size'),
            'category_id' => (int)$this->input('category_id'),
            'title' => (string)$this->input('title'),
            'duration' => (int)$this->input('duration'),
            'url' => (string)$this->input('url'),
            'aliyun_video_id'=>(string)$this->input('aliyun_video_id'),

        ];
    }

}
